package com.weic.easycache.framework;

import java.util.HashMap;
import java.util.Map;

public class Theme {
	public static final Theme DAY	= registerTheme("day", "");
	public static final Theme NIGHT	= registerTheme("night", "_night");

	public final String name;
	public final String suffix;
	private Theme(String name, String suffix) {
		this.name = name;
		this.suffix = suffix;
	}
	
	public void apply() {
		
	}
	
	public String formatResName(String resName) {
		return resName + suffix;
	}
	
	/**
	 * @param name
	 * @param suffix
	 * @return null 表示该name的Theme已经注册
	 */
	public static Theme registerTheme(String name, String suffix) {
		if(themes.containsKey(name)) return null;
		Theme theme = new Theme(name, suffix);
		themes.put(name, theme);
		return theme;
	}
	
	public static Theme unRegisterTheme(String name) {
		return themes.remove(name);
	}
	
	private static final Map<String, Theme> themes = new HashMap<String, Theme>();
}
